Your one stop shop for all those nasty hidden input-only windows.
create_moveresize_window (MoveResizeData *mv_resize,
guint32 timestamp)
{
- GdkWindowAttr attributes;
- gint attributes_mask;
GdkGrabStatus status;
GdkSeat *seat;
GdkDevice *pointer;
g_assert (mv_resize->moveresize_emulation_window == NULL);
- attributes.x = -100;
- attributes.y = -100;
- attributes.width = 10;
- attributes.height = 10;
- attributes.window_type = GDK_WINDOW_TEMP;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = 0;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- mv_resize->moveresize_emulation_window =
- gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (mv_resize->display)),
- &attributes,
- attributes_mask);
+ mv_resize->moveresize_emulation_window = gdk_window_new_temp (mv_resize->display);
gdk_window_show (mv_resize->moveresize_emulation_window);
&attr,
GDK_WA_X | GDK_WA_Y);
}
+
+/**
+ * gdk_window_new_temp: (constructor)
+ * @display: the display to create the window on
+ *
+ * Creates a new toplevel temporary window. The window will be
+ * situated off-screen and not handle output.
+ *
+ * You most likely do not want to use this function.
+ *
+ * Returns: (transfer full): the new #GdkWindow
+ *
+ * Since: 3.90
+ **/
+GdkWindow *
+gdk_window_new_temp (GdkDisplay *display)
+{
+ GdkWindowAttr attr;
+
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ attr.event_mask = 0;
+ attr.wclass = GDK_INPUT_ONLY;
+ attr.x = -100;
+ attr.y = -100;
+ attr.width = 10;
+ attr.height = 10;
+ attr.window_type = GDK_WINDOW_TEMP;
+
+ return gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (display)),
+ &attr,
+ GDK_WA_X | GDK_WA_Y);
+}
+
/**
* gdk_window_new_child: (constructor)
* @parent: the parent window
gint event_mask,
const GdkRectangle *position);
GDK_AVAILABLE_IN_3_90
+GdkWindow * gdk_window_new_temp (GdkDisplay *display);
+GDK_AVAILABLE_IN_3_90
GdkWindow * gdk_window_new_child (GdkWindow *parent,
gint event_mask,
const GdkRectangle *position);
Display *xdisplay;
GdkDisplay *display;
GdkX11Display *display_x11;
- GdkWindowAttr attr;
gint argc;
gchar *argv[1];
gdk_event_init (display);
- attr.window_type = GDK_WINDOW_TOPLEVEL;
- attr.wclass = GDK_INPUT_ONLY;
- attr.x = 10;
- attr.y = 10;
- attr.width = 10;
- attr.height = 10;
- attr.event_mask = 0;
-
- display_x11->leader_gdk_window = gdk_window_new (GDK_X11_SCREEN (display_x11->screen)->root_window,
- &attr, GDK_WA_X | GDK_WA_Y);
+ display_x11->leader_gdk_window = gdk_window_new_temp (display);
(_gdk_x11_window_get_toplevel (display_x11->leader_gdk_window))->is_leader = TRUE;
display_x11->leader_window = GDK_WINDOW_XID (display_x11->leader_gdk_window);
create_moveresize_window (MoveResizeData *mv_resize,
guint32 timestamp)
{
- GdkWindowAttr attributes;
- gint attributes_mask;
GdkGrabStatus status;
g_assert (mv_resize->moveresize_emulation_window == NULL);
- attributes.x = -100;
- attributes.y = -100;
- attributes.width = 10;
- attributes.height = 10;
- attributes.window_type = GDK_WINDOW_TEMP;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = 0;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- mv_resize->moveresize_emulation_window =
- gdk_window_new (gdk_screen_get_root_window (gdk_display_get_default_screen (mv_resize->display)),
- &attributes,
- attributes_mask);
-
+ mv_resize->moveresize_emulation_window = gdk_window_new_temp (mv_resize->display);
gdk_window_show (mv_resize->moveresize_emulation_window);
status = gdk_seat_grab (gdk_device_get_seat (mv_resize->device),
static void
gtk_invisible_realize (GtkWidget *widget)
{
- GdkWindow *parent;
GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
gtk_widget_set_realized (widget, TRUE);
- parent = gtk_widget_get_parent_window (widget);
- if (parent == NULL)
- parent = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
-
- attributes.x = -100;
- attributes.y = -100;
- attributes.width = 10;
- attributes.height = 10;
- attributes.window_type = GDK_WINDOW_TEMP;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = gtk_widget_get_events (widget);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- window = gdk_window_new (parent, &attributes, attributes_mask);
+ window = gdk_window_new_temp (gtk_widget_get_display (widget));
gtk_widget_set_window (widget, window);
gtk_widget_register_window (widget, window);
}
GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
if (!window)
{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GdkWindow *parent;
-
- attributes.x = -100;
- attributes.y = -100;
- attributes.width = 10;
- attributes.height = 10;
- attributes.window_type = GDK_WINDOW_TEMP;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = 0;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- parent = gdk_screen_get_root_window (gtk_widget_get_screen (GTK_WIDGET (menu)));
- window = gdk_window_new (parent,
- &attributes, attributes_mask);
+ window = gdk_window_new_temp (gtk_widget_get_display (GTK_WIDGET (menu)));
gtk_widget_register_window (GTK_WIDGET (menu), window);
gdk_window_show (window);